package com.todo.strategy.offline.application.handler.relation;

import com.todo.strategy.common.enums.StrategyRelationTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author azhebuxing
 * @date 2024/7/3 13:50
 * @description
 */
@Component
public class StrategyRelationFactory {

    @Autowired
    private List<StrategyRelationStrategy> strategyList;


    public StrategyRelationStrategy getStrategy(StrategyRelationTypeEnum typeEnum) {
        if (strategyList == null || typeEnum == null){
            return null;
        }
        for (StrategyRelationStrategy strategy : strategyList ){
            if (typeEnum.equals(strategy.getHandleName())){
                return strategy;
            }
        }
        return null;
    }
}
